<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#000"><meta name="generator" content="Hexo 7.3.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#000">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/pace/1.2.4/themes/blue/pace-theme-minimal.css">
  <script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"lm379.cn","root":"/","images":"/images","scheme":"Muse","darkmode":false,"version":"8.12.2","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":true}}</script><script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-next/8.12.2/config.min.js"></script>

    <meta name="description" content="[未完待续] 大数据hadoop实验一">
<meta property="og:type" content="article">
<meta property="og:title" content="hadoop的安装和使用">
<meta property="og:url" content="https://lm379.cn/2024/10/08/%E5%A4%A7%E6%95%B0%E6%8D%AE/hadoop%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8/index.html">
<meta property="og:site_name" content="lm379のBlog">
<meta property="og:description" content="[未完待续] 大数据hadoop实验一">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/9fdbf53c77de3ecd157606917dd1249d.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/70e9a482c4c57787d9499f09763d2362.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/1122797ea3a40833378a8c0c52cf6214.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/00ddb8793853ded0ea8a8ac63573bc4c.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/594d70fe760049482f5053ea6562885c.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/1726e5af313bf5d4b3c05f7397b0a2b6.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/0fa26d5c151bceb2c242cf9d0db12d02.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/75b1719888a05cb6bfc2ed74198f1209.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/cb0ffdd1f4f8067d213ddcd3047fcdb2.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/3366f348380587456d26b8d13b0f6f91.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/6ec5f2518820207824ce15c676e034a7.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/e64abbf1310cc32831c33b1c03e1a657.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/e6279739e429fe40ea3e9415cb0e9e76.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/be270449ec084ba55856f5aad10c10a0.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/6966563a8ac54f54f244e8699305d56f.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/fd36ed979ea8dbefbf44ee02c59e76da.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/20724af84e6c525557771d9c493e4d12.png">
<meta property="og:image" content="https://r2.lm379.cn/2024/10/999f28fbe5aa8a322b778749ffc69c25.png">
<meta property="article:published_time" content="2024-10-08T11:12:40.000Z">
<meta property="article:modified_time" content="2024-12-25T14:03:20.000Z">
<meta property="article:author" content="lm379">
<meta property="article:tag" content="大数据">
<meta property="article:tag" content="Hadoop">
<meta property="article:tag" content="虚拟机">
<meta property="article:tag" content="Linux">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://r2.lm379.cn/2024/10/9fdbf53c77de3ecd157606917dd1249d.png">


<link rel="canonical" href="https://lm379.cn/2024/10/08/%E5%A4%A7%E6%95%B0%E6%8D%AE/hadoop%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://lm379.cn/2024/10/08/%E5%A4%A7%E6%95%B0%E6%8D%AE/hadoop%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8/","path":"2024/10/08/大数据/hadoop的安装和使用/","title":"hadoop的安装和使用"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>hadoop的安装和使用 | lm379のBlog</title>
  



  <script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{&quot;token&quot;: &quot;5a58651dc232489989204bf6775afe7a&quot;}'></script>


  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">lm379のBlog</p>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">44</span></a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">11</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">58</span></a></li><li class="menu-item menu-item-commonweal"><a href="/404/" rel="section"><i class="fa fa-heartbeat fa-fw"></i>公益 404</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE"><span class="nav-number">1.</span> <span class="nav-text"> 环境配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="nav-number">2.</span> <span class="nav-text"> 安装虚拟机</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-%E6%96%B0%E5%BB%BA%E8%99%9A%E6%8B%9F%E6%9C%BA%E9%80%89%E6%8B%A9%E9%95%9C%E5%83%8F%E6%96%87%E4%BB%B6"><span class="nav-number">2.1.</span> <span class="nav-text"> 1. 新建虚拟机，选择镜像文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-%E6%9B%B4%E6%8D%A2%E9%95%9C%E5%83%8F%E6%BA%90%E6%9B%B4%E6%96%B0%E8%BD%AF%E4%BB%B6%E5%8C%85"><span class="nav-number">2.2.</span> <span class="nav-text"> 2. 更换镜像源&amp;&amp;更新软件包</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-%E6%96%B0%E5%BB%BAhadoop%E7%94%A8%E6%88%B7"><span class="nav-number">2.3.</span> <span class="nav-text"> 3. 新建hadoop用户</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-%E5%BC%80%E5%90%AF%E8%99%9A%E6%8B%9F%E6%9C%BAssh%E6%9C%8D%E5%8A%A1"><span class="nav-number">2.4.</span> <span class="nav-text"> 4. 开启虚拟机SSH服务</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%AE%BF%E4%B8%BB%E6%9C%BA%E9%80%9A%E8%BF%87ssh%E5%B7%A5%E5%85%B7%E8%BF%9E%E6%8E%A5%E5%88%B0%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="nav-number">2.4.1.</span> <span class="nav-text"> 宿主机通过SSH工具连接到虚拟机</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E9%85%8D%E7%BD%AEjava%E7%8E%AF%E5%A2%83"><span class="nav-number">3.</span> <span class="nav-text"> 配置Java环境</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E5%B9%B6%E5%88%9D%E5%A7%8B%E5%8C%96hadoop"><span class="nav-number">4.</span> <span class="nav-text"> 安装并初始化Hadoop</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85"><span class="nav-number">4.1.</span> <span class="nav-text"> 安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9D%E5%A7%8B%E5%8C%96"><span class="nav-number">4.2.</span> <span class="nav-text"> 初始化</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="lm379"
      src="https://r2.lm379.cn/2024/05/4e267962f6254f01166242c803cd488f.jpg">
  <p class="site-author-name" itemprop="name">lm379</p>
  <div class="site-description" itemprop="description">记录个人的折腾之旅</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">58</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">11</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">44</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/lm379" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;lm379" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:lm379@foxmail.com" title="E-Mail → mailto:lm379@foxmail.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://weibo.com/u/6997206595" title="Weibo → https:&#x2F;&#x2F;weibo.com&#x2F;u&#x2F;6997206595" rel="noopener" target="_blank"><i class="fab fa-weibo fa-fw"></i>Weibo</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://space.bilibili.com/299502822" title="B站 → https:&#x2F;&#x2F;space.bilibili.com&#x2F;299502822" rel="noopener" target="_blank"><i class="fa bilibili fa-fw"></i>B站</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://www.zhihu.com/people/lm379" title="知乎 → https:&#x2F;&#x2F;www.zhihu.com&#x2F;people&#x2F;lm379" rel="noopener" target="_blank"><i class="fa zhihu fa-fw"></i>知乎</a>
      </span>
      <span class="links-of-author-item">
        <a href="http://www.coolapk.com/u/3126124" title="酷安 → http:&#x2F;&#x2F;www.coolapk.com&#x2F;u&#x2F;3126124" rel="noopener" target="_blank"><i class="fa coolapk fa-fw"></i>酷安</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://www.xiaohongshu.com/user/profile/6306019b0000000012001f11" title="小红书 → https:&#x2F;&#x2F;www.xiaohongshu.com&#x2F;user&#x2F;profile&#x2F;6306019b0000000012001f11" rel="noopener" target="_blank"><i class="fa xiaohongshu fa-fw"></i>小红书</a>
      </span>
  </div>


  <div class="links-of-blogroll site-overview-item animated">
    <div class="links-of-blogroll-title"><i class="fa fa-globe fa-fw"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://pan.lm379.cn/" title="https:&#x2F;&#x2F;pan.lm379.cn" rel="noopener" target="_blank">OpenList</a>
        </li>
    </ul>
  </div>

        </div>
      </div>
        <div class="back-to-top animated" role="button" aria-label="返回顶部">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://lm379.cn/2024/10/08/%E5%A4%A7%E6%95%B0%E6%8D%AE/hadoop%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://r2.lm379.cn/2024/05/4e267962f6254f01166242c803cd488f.jpg">
      <meta itemprop="name" content="lm379">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="lm379のBlog">
      <meta itemprop="description" content="记录个人的折腾之旅">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="hadoop的安装和使用 | lm379のBlog">
      <meta itemprop="description" content="[未完待续] 大数据hadoop实验一">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          hadoop的安装和使用
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2024-10-08 19:12:40" itemprop="dateCreated datePublished" datetime="2024-10-08T19:12:40+08:00">2024-10-08</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2024-12-25 22:03:20" itemprop="dateModified" datetime="2024-12-25T22:03:20+08:00">2024-12-25</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%A4%A7%E6%95%B0%E6%8D%AE/" itemprop="url" rel="index"><span itemprop="name">大数据</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
</div>

            <div class="post-description">[未完待续] 大数据hadoop实验一</div>
        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h2 id="环境配置"><a class="markdownIt-Anchor" href="#环境配置"></a> 环境配置</h2>
<ul>
<li>UbuntuKylin 16.04.7</li>
<li>JDK 1.8.0</li>
</ul>

<div class="callout" data-callout="note">
<div class="callout-title">
<div class="callout-title-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pencil"><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/></svg>
</div>
<div class="callout-title-inner">Note</div>
</div>
<div class="callout-content"><p><strong>下面的操作其实就是安装虚拟机和配置环境</strong><br />
本文是写给Linux小白和为了完成作业和修学分的大学生的<br />
熟悉Linux的人自己挑关键部分看就行</p>
</div></div><h2 id="安装虚拟机"><a class="markdownIt-Anchor" href="#安装虚拟机"></a> 安装虚拟机</h2>
<p>本文使用<a target="_blank" rel="noopener" href="https://www.vmware.com/">VMware</a>安装，你也可以使用virtualbox，WSL等环境构建</p>
<h3 id="1-新建虚拟机选择镜像文件"><a class="markdownIt-Anchor" href="#1-新建虚拟机选择镜像文件"></a> 1. 新建虚拟机，选择镜像文件</h3>
<p><img src="https://r2.lm379.cn/2024/10/9fdbf53c77de3ecd157606917dd1249d.png" alt="" /></p>
<p>磁盘空间建议设置大一点，用户名可以任意，或者直接设置为 <mark>hadoop</mark>，其他配置按需调整，接下来一路完成即可</p>
<p><img src="https://r2.lm379.cn/2024/10/70e9a482c4c57787d9499f09763d2362.png" alt="" /></p>
<p>等待安装完毕进入系统</p>
<blockquote>
<p>注意，安装时建议不要勾选更新和下载软件，默认源很慢</p>
</blockquote>
<h3 id="2-更换镜像源更新软件包"><a class="markdownIt-Anchor" href="#2-更换镜像源更新软件包"></a> 2. 更换镜像源&amp;&amp;更新软件包</h3>

<div class="callout" data-callout="tip">
<div class="callout-title">
<div class="callout-title-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-flame"><path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/></svg>
</div>
<div class="callout-title-inner">Tip</div>
</div>
<div class="callout-content"><p><strong>通过命令更换ubuntu镜像可以参考我这篇文章</strong><br />
<a  href="/2024/06/14/部分公共服务镜像/">部分公共服务镜像</a></p>
</div></div><p>对新手来说，换源还是建议通过ubuntu内置的镜像源选择器</p>
<p>位置在：右上角找到设置-系统设置(<code>System Settings</code>)</p>
<p><img src="https://r2.lm379.cn/2024/10/1122797ea3a40833378a8c0c52cf6214.png" alt="" /><br />
<img src="https://r2.lm379.cn/2024/10/00ddb8793853ded0ea8a8ac63573bc4c.png" alt="" /><br />
<code>Download from</code>点击<code>Other</code>，往上翻找到<code>China</code>，选择一个镜像即可</p>
<blockquote>
<p>个人建议选择中科大<code>mirrors.ustc.edu.cn</code>或者清华大学<code>tsinghua</code>，不建议使用阿里云<code>aliyun</code>，部分地区速度比不换还慢</p>
</blockquote>
<p><img src="https://r2.lm379.cn/2024/10/594d70fe760049482f5053ea6562885c.png" alt="" /></p>
<p>后会弹出一个窗口提示软件列表已过时，我们点击<mark>关闭</mark></p>
<p>回到桌面，右键任意空白处选择<code>Open Terminal</code>进入终端输入，并输入之前设置的密码</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> apt update &amp;&amp; apt upgrade -y</span><br></pre></td></tr></table></figure>
<p>等待命令执行完成</p>

<div class="callout" data-callout="tip">
<div class="callout-title">
<div class="callout-title-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-flame"><path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/></svg>
</div>
<div class="callout-title-inner">Tip</div>
</div>
<div class="callout-content"><p><strong>ps: 期间如果报错无法连接到<code>ubuntukylin.com</code>， 或者卡在这里</strong><br />
就按<code>Ctrl+C</code>结束当前命令后，输入以下命令删除UbuntuKylin的软件源后重新执行上面的命令</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> <span class="built_in">rm</span> -rf /etc/apt/sources.list.d/ubuntukylin.list</span><br></pre></td></tr></table></figure>
</div></div><h3 id="3-新建hadoop用户"><a class="markdownIt-Anchor" href="#3-新建hadoop用户"></a> 3. 新建hadoop用户</h3>
<blockquote>
<p>若第一步建立的用户就是hadoop，直接跳过即可</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> useradd -m hadoop -s /bin/bash </span><br><span class="line"><span class="comment"># 给hadoop用户设置密码</span></span><br><span class="line"><span class="built_in">sudo</span> passwd hadoop  </span><br><span class="line"><span class="comment"># 给hadoop用户sudo权限</span></span><br><span class="line"><span class="built_in">sudo</span> adduser hadoop <span class="built_in">sudo</span></span><br></pre></td></tr></table></figure>
<p>然后注销，以hadoop用户重新登录</p>
<h3 id="4-开启虚拟机ssh服务"><a class="markdownIt-Anchor" href="#4-开启虚拟机ssh服务"></a> 4. 开启虚拟机SSH服务</h3>

<div class="callout" data-callout="question">
<div class="callout-title">
<div class="callout-title-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-help-circle"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/></svg>
</div>
<div class="callout-title-inner"><strong>为什么要开启SSH呢</strong></div>
</div>
<div class="callout-content"><p>开启SSH后，我们可以直接在宿主机通过<mark>SSH客户端</mark>连接到虚拟机的终端，以实现宿主机直接复制粘贴到虚拟机内<br />
同时也可以通过<code>SFTP</code>协议实现宿主机和虚拟机文件互相传输<br />
<mark>如果使用WSL，这一步直接省略即可，虚拟机安装的建议开启SSH服务</mark></p>
<blockquote>
<p>虚拟机内部和宿主机的剪贴板共享容易出问题</p>
</blockquote>
</div></div><p>同样打开右键终端输入，根据提示输入y确认</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> apt-get install openssh-server</span><br></pre></td></tr></table></figure>
<p>安装完成后输入下面的命令测试SSH服务是否成功安装</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh localhost</span><br></pre></td></tr></table></figure>
<p>如出现类似下图的提示，说明安装成功</p>
<p><img src="https://r2.lm379.cn/2024/10/1726e5af313bf5d4b3c05f7397b0a2b6.png" alt="" /></p>
<p>然后按<code>Ctrl+C</code>取消连接</p>
<h4 id="宿主机通过ssh工具连接到虚拟机"><a class="markdownIt-Anchor" href="#宿主机通过ssh工具连接到虚拟机"></a> 宿主机通过SSH工具连接到虚拟机</h4>
<p>常用的SSH工具有<a target="_blank" rel="noopener" href="https://www.xshell.com/zh/xshell/">XSHELL</a> <a target="_blank" rel="noopener" href="https://mobaxterm.mobatek.net/">MobaXterm</a> <a target="_blank" rel="noopener" href="https://www.hostbuf.com/">FinalShell</a> <a target="_blank" rel="noopener" href="https://putty.org/">PuTTY</a> 等等</p>
<blockquote>
<p>Windows内置了SSH的命令行客户端，可以直接调出CMD，PowerShell或者Windows Terminal通过命令连接，VMware内置的SSH连接就是调用Windows自带的终端实现的<br />
<img src="https://r2.lm379.cn/2024/10/0fa26d5c151bceb2c242cf9d0db12d02.png" alt="" /></p>
<p>第一次连接需要先输入<mark>yes</mark>，然后输入当前用户的密码即可连接<br />
<img src="https://r2.lm379.cn/2024/10/75b1719888a05cb6bfc2ed74198f1209.png" alt="" /></p>
<p>直接在命令行内输入<code>ssh username@ip</code> 也能达到同样的效果</p>
</blockquote>
<p>那么问题来了，既然内置的工具已经可以实现命令交互，为什么还需要第三方SSH工具呢？</p>
<p>上面的截图可以看到，Windows Terminal基本仅仅支持命令行，而很多SSH工具内置了SFTP传输文件，保存连接配置，设置自定义密钥，有些甚至还支持查看远程主机的系统资源信息，下面我以个人比较习惯的<a target="_blank" rel="noopener" href="https://www.xshell.com/zh/xshell/">XShell</a>为例</p>
<p>XShell这个软件功能非常强大，虽然软件收费，但是对于个人和学校是免费使用的<br />
可以在<a target="_blank" rel="noopener" href="https://www.xshell.com/zh/free-for-home-school/">家庭/学校免费 - NetSarang Website (xshell.com)</a>直接下载XShell和XFTP这两个组件</p>
<blockquote>
<p>XShell的SFTP基于XFTP实现，所以都要下载<br />
然后输入用户名和邮箱即可免费注册使用</p>
</blockquote>
<p>在连接之前需要知道虚拟机网络连接方式和虚拟机的IP地址<br />
我这里虚拟机网络为<mark>NAT</mark>模式，后面也以<mark>NAT</mark>方式为例<br />
<img src="https://r2.lm379.cn/2024/10/cb0ffdd1f4f8067d213ddcd3047fcdb2.png" alt="" /></p>
<p>进入虚拟机，点击网络，找到连接信息<img src="https://r2.lm379.cn/2024/10/3366f348380587456d26b8d13b0f6f91.png" alt="" /><br />
图中的位置就是虚拟机的IP地址，比如我的就是 <mark>192.168.121.129</mark><br />
<img src="https://r2.lm379.cn/2024/10/6ec5f2518820207824ce15c676e034a7.png" alt="" /></p>
<p>然后在VMware中点击 <code>编辑</code> - <code>虚拟网络编辑器</code>，并以管理员重新打开<br />
<img src="https://r2.lm379.cn/2024/10/e64abbf1310cc32831c33b1c03e1a657.png" alt="" /><br />
然后在上面选择和虚拟机相同网段的虚拟网卡后，点击NAT设置，按下图的方式填写端口转发<br />
<img src="https://r2.lm379.cn/2024/10/e6279739e429fe40ea3e9415cb0e9e76.png" alt="" /><br />
回到XShell，点击新增，在主机处输入虚拟机IP地址<br />
<img src="https://r2.lm379.cn/2024/10/be270449ec084ba55856f5aad10c10a0.png" alt="" /><br />
然后点击左侧用户身份验证，输入虚拟机的用户名和密码点击连接即可</p>
<blockquote>
<p>第一次连接需要接受主机密钥<br />
<img src="https://r2.lm379.cn/2024/10/6966563a8ac54f54f244e8699305d56f.png" alt="" /><br />
然后就进到了SSH终端，可以和<br />
<img src="https://r2.lm379.cn/2024/10/fd36ed979ea8dbefbf44ee02c59e76da.png" alt="" /></p>
</blockquote>
<h2 id="配置java环境"><a class="markdownIt-Anchor" href="#配置java环境"></a> 配置Java环境</h2>
<p>这里不通过apt直接安装，而是手动下载jdk进行安装</p>
<blockquote>
<p>实测通过apt安装的JDK会存在莫名其妙的问题</p>
</blockquote>
<p>下面通过<a target="_blank" rel="noopener" href="https://repo.huaweicloud.com/java/jdk/">华为云JDK镜像</a>进行下载，虽然这个网站已经很久没有更新了，不过我下载的是JDK1.8，这里面有<br />
我选择的是JDK-8u202版本，Linux系统下载图中这个就行<br />
<img src="https://r2.lm379.cn/2024/10/20724af84e6c525557771d9c493e4d12.png" alt="" /><br />
下载完成后通过SFTP工具(上面的XFTP)传到虚拟机内，也可以命令行下载</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> ~/</span><br><span class="line">wget https://repo.huaweicloud.com/java/jdk/8u202-b08/jdk-8u202-linux-x64.tar.gz</span><br></pre></td></tr></table></figure>
<p>然后创建一个文件夹用来存放Java环境，并解压JVM文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> <span class="built_in">mkdir</span> /usr/lib/jvm</span><br><span class="line"><span class="built_in">sudo</span> tar -zxvf jdk-8u202-linux-x64.tar.gz -C /usr/lib/jvm/</span><br></pre></td></tr></table></figure>
<p>并通过如下命令修改环境变量</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> nano ~/.bashrc</span><br></pre></td></tr></table></figure>
<p>定位到文件末尾</p>
<blockquote>
<p>小技巧： nano编辑器中快速定位文件末尾快捷键 :先<code>Ctrl+W</code> 再 <code>Ctrl+V</code></p>
</blockquote>
<p>在末尾输入如下配置</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_202  # 注意这一行为JDK解压后的目录，不同的JDK版本不同</span><br><span class="line">export JRE_HOME=$&#123;JAVA_HOME&#125;/jre</span><br><span class="line">export CLASSPATH=.:$&#123;JAVA_HOME&#125;/lib:$&#123;JRE_HOME&#125;/lib</span><br><span class="line">export PATH=$&#123;JAVA_HOME&#125;/bin:$PATH</span><br></pre></td></tr></table></figure>
<p>然后通过快捷键 <code>Ctrl+O</code>回车保存， <code>Ctrl+X</code>退出nano编辑器<br />
通过如下命令使刚才修改的配置生效</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">source</span> ~/.bashrc</span><br></pre></td></tr></table></figure>
<p>并通过命令 <code>java -version</code> 验证JDK是否配置成功，如果成功则会输出如下信息</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">lm379@ubuntu:~$ java -version</span><br><span class="line">java version <span class="string">&quot;1.8.0_202&quot;</span></span><br><span class="line">Java(TM) SE Runtime Environment (build 1.8.0_202-b08)</span><br><span class="line">Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)</span><br></pre></td></tr></table></figure>
<h2 id="安装并初始化hadoop"><a class="markdownIt-Anchor" href="#安装并初始化hadoop"></a> 安装并初始化Hadoop</h2>
<h3 id="安装"><a class="markdownIt-Anchor" href="#安装"></a> 安装</h3>
<p>下面以<a target="_blank" rel="noopener" href="https://mirrors.ustc.edu.cn/apache/hadoop/common/">中科大镜像</a> 为例，也可以去其他镜像站比如<a target="_blank" rel="noopener" href="https://mirrors.tencent.com/apache/hadoop/common">腾讯云镜像</a>下载<br />
可以先在主机下载，通过XFTP传到主机，不过我一般习惯直接通过wget<br />
以3.4.0版本为例</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> ~</span><br><span class="line">wget https://mirrors.ustc.edu.cn/apache/hadoop/common/hadoop-3.4.0/hadoop-3.4.0.tar.gz</span><br><span class="line"><span class="built_in">sudo</span> tar -zxvf hadoop-3.4.0.tar.gz -C /usr/local/</span><br><span class="line"><span class="built_in">cd</span> /usr/local</span><br><span class="line"><span class="comment"># 重命名文件夹</span></span><br><span class="line"><span class="built_in">sudo</span> <span class="built_in">mv</span> hadoop-3.4.0/ hadoop/</span><br><span class="line"><span class="comment"># 赋予文件夹权限</span></span><br><span class="line"><span class="built_in">sudo</span> <span class="built_in">chown</span> -R hadoop ./hadoop</span><br></pre></td></tr></table></figure>
<p>通过如下命令检查Hadoop是否安装成功，如果成功会输出版本信息</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /usr/local/hadoop</span><br><span class="line">./bin/hadoop version</span><br></pre></td></tr></table></figure>
<p>输出的版本信息示例</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">hadoop@ubuntu:/usr/local/hadoop$ ./bin/hadoop version</span><br><span class="line">Hadoop 3.4.0</span><br><span class="line">Source code repository git@github.com:apache/hadoop.git -r bd8b77f398f626bb7791783192ee7a5dfaeec760</span><br><span class="line">Compiled by root on 2024-03-04T06:35Z</span><br><span class="line">Compiled on platform linux-x86_64</span><br><span class="line">Compiled with protoc 3.21.12</span><br><span class="line">From source with checksum f7fe694a3613358b38812ae9c31114e</span><br><span class="line">This command was run using /usr/local/hadoop/share/hadoop/common/hadoop-common-3.4.0.jar</span><br></pre></td></tr></table></figure>
<h3 id="初始化"><a class="markdownIt-Anchor" href="#初始化"></a> 初始化</h3>
<p>初始化之前需要先修改两个配置文件： <code>core-site.xml</code> 和 <code>hdfs-site.xml</code></p>
<p>这两个文件位于目录 <code>/usr/local/hadoop/etc/hadoop</code> 下</p>
<blockquote>
<p>这句话写给新手：建议使用nano vim之类的编辑器，通过终端输入，不要一个一个傻傻的敲</p>
<p>如果你实在不会nano或者vim，也可以用VSCode的Remote SSH组件，直接在宿主机内用VSCode编辑</p>
</blockquote>
<p>两个文件的具体配置如下</p>
<p><strong>core-site.xml</strong></p>
 <figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">configuration</span>&gt;</span></span><br><span class="line">   <span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">       <span class="tag">&lt;<span class="name">name</span>&gt;</span>hadoop.tmp.dir<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">       <span class="tag">&lt;<span class="name">value</span>&gt;</span>file:/usr/local/hadoop/tmp<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">       <span class="tag">&lt;<span class="name">description</span>&gt;</span>Abase for other temporary directories.<span class="tag">&lt;/<span class="name">description</span>&gt;</span></span><br><span class="line">   <span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">   <span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">name</span>&gt;</span>fs.defaultFS<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">       <span class="tag">&lt;<span class="name">value</span>&gt;</span>hdfs://localhost:9000<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">   <span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">configuration</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><strong>hdfs-site.xml</strong></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">configuration</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">name</span>&gt;</span>dfs.replication<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">value</span>&gt;</span>1<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">name</span>&gt;</span>dfs.namenode.name.dir<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">value</span>&gt;</span>file:/usr/local/hadoop/tmp/dfs/name<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">property</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">name</span>&gt;</span>dfs.datanode.data.dir<span class="tag">&lt;/<span class="name">name</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">value</span>&gt;</span>file:/usr/local/hadoop/tmp/dfs/data<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">configuration</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>修改完成后，开始执行初始化</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /usr/local/hadoop</span><br><span class="line">./bin/hdfs namenode -format</span><br></pre></td></tr></table></figure>
<p>然后可以看到如下的输出，其中包含 <code>successfully formatted</code> 说明初始化完成<br />
<img src="https://r2.lm379.cn/2024/10/999f28fbe5aa8a322b778749ffc69c25.png" alt="" /><br />
初始化成功后就可以开始运行了</p>
<p>执行</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./sbin/start-dfs.sh</span><br></pre></td></tr></table></figure>
    </div>

    
    
    

    <footer class="post-footer">
          <div class="reward-container">
  <div>打赏</div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="https://r2.lm379.cn/2024/04/f597f96be857f5d530a787c8b81731da.jpg" alt="lm379 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          <div class="post-tags">
              <a href="/tags/%E5%A4%A7%E6%95%B0%E6%8D%AE/" rel="tag"><i class="fa fa-tag"></i> 大数据</a>
              <a href="/tags/Hadoop/" rel="tag"><i class="fa fa-tag"></i> Hadoop</a>
              <a href="/tags/%E8%99%9A%E6%8B%9F%E6%9C%BA/" rel="tag"><i class="fa fa-tag"></i> 虚拟机</a>
              <a href="/tags/Linux/" rel="tag"><i class="fa fa-tag"></i> Linux</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2024/09/25/openwrt%E6%89%8B%E5%8A%A8%E7%BC%96%E8%AF%91ipk/" rel="prev" title="openwrt手动编译ipk">
                  <i class="fa fa-chevron-left"></i> openwrt手动编译ipk
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2024/12/08/%E5%A4%B4%E6%AD%8CC%E8%AF%AD%E8%A8%80%E5%AE%9E%E9%AA%8C/%E5%A4%B4%E6%AD%8CC%E8%AF%AD%E8%A8%80%E5%AE%9E%E9%AA%8C-%E7%BB%83%E4%B9%A04%EF%BC%9A%E9%80%89%E6%8B%A9%E7%BB%93%E6%9E%84-II/" rel="next" title="头歌C语言实验 练习4：选择结构 II">
                  头歌C语言实验 练习4：选择结构 II <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    
  
  <div class="comments giscus-container">
  </div>
  
  
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="beian"><a href="https://beian.miit.gov.cn/" rel="noopener" target="_blank">蜀ICP备2022016740号-1 </a>
  </div>

<div class="copyright">
  &copy; 2022 – 
  <span itemprop="copyrightYear">2025</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">lm379. All Rights Reserved.</span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>

    </div>
  </footer>

  
  <script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-next/8.12.2/comments.min.js"></script><script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-next/8.12.2/utils.min.js"></script><script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-next/8.12.2/motion.min.js"></script><script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-next/8.12.2/schemes/muse.min.js"></script><script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-next/8.12.2/next-boot.min.js"></script>

  
<script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-generator-searchdb/1.4.0/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-next/8.12.2/third-party/search/local-search.min.js"></script>




  <script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-next/8.12.2/third-party/pace.min.js"></script>

  
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><link rel="stylesheet" href="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/KaTeX/0.16.0/katex.min.css" integrity="sha256-uik/hNqHWZldXh/0K35nqOSCff9F61/ZOFReqNOBgB0=" crossorigin="anonymous">
  <script class="next-config" data-name="katex" type="application/json">{"copy_tex_js":{"url":"https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/KaTeX/0.16.0/contrib/copy-tex.min.js","integrity":"sha256-Us54+rSGDSTvIhKKUs4kygE2ipA0RXpWWh0/zLqw3bs="}}</script>
  <script src="https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-next/8.12.2/third-party/math/katex.min.js"></script>


<script class="next-config" data-name="giscus" type="application/json">{"enable":true,"repo":"lm379/lm379.github.io","repo_id":"R_kgDOHoD2KA","category":"Announcements","category_id":"DIC_kwDOHoD2KM4CgEIm","mapping":"title","strict":0,"reactions_enabled":1,"emit_metadata":0,"theme":"light_tritanopia","lang":"zh-CN","crossorigin":"anonymous","input_position":"top","loading":"lazy"}</script>

<script>
document.addEventListener('page:loaded', () => {
  if (!CONFIG.page.comments) return;

  NexT.utils.loadComments('.giscus-container')
    .then(() => NexT.utils.getScript('https://giscus.app/client.js', {
      attributes: {
        async                   : true,
        crossOrigin             : 'anonymous',
        'data-repo'             : CONFIG.giscus.repo,
        'data-repo-id'          : CONFIG.giscus.repo_id,
        'data-category'         : CONFIG.giscus.category,
        'data-category-id'      : CONFIG.giscus.category_id,
        'data-mapping'          : CONFIG.giscus.mapping,
        'data-strict'           : CONFIG.giscus.strict,
        'data-reactions-enabled': CONFIG.giscus.reactions_enabled,
        'data-emit-metadata'    : CONFIG.giscus.emit_metadata,
        'data-theme'            : CONFIG.giscus.theme,
        'data-lang'             : CONFIG.giscus.lang,
        'data-input-position'   : CONFIG.giscus.input_position,
        'data-loading'          : CONFIG.giscus.loading
      },
      parentNode: document.querySelector('.giscus-container')
    }));
});
</script>


  <link rel="stylesheet" href="/dist/APlayer.min.css">
  <div id="aplayer"></div>
  <script type="text/javascript" src="/dist/APlayer.min.js"></script>
  <script type="text/javascript" src="/dist/music.js"></script>  

  <script type="text/javascript" src="\js\FunnyTitle.js"></script>

</body>
</html>
